<template>
  <div class="xtx-tabs-panel" v-show="name === activeName">
    <slot />
  </div>
</template>

<script>
import { inject } from '@vue/runtime-core'
export default {
  name: 'XtxTabsPanel',
  props: {
    // 选项卡名字
    label: {
      type: String,
      default: '',
    },
    // 唯一标识
    name: {
      type: [String, Number],
      default: '',
    },
  },
  setup() {
    // 接收选中的 name 进行渲染对应内容
    const activeName = inject('activeName')
    return { activeName }
  },
}
</script>
